#include"heap.h"

void HeapCreate(Heap* hp, HPDataType* a, int n)
{
    HPDataType *tem=(HPDataType*)malloc((n+1)*sizeof(HPDataType));
    if(tem==NULL)
    {
        perror("malloc fail");
    }
    hp->_a=tem;
    hp->_capacity=n+1;
}

void HeapDestory(Heap* hp)
{
    assert(hp);
    free(hp->_a);
    hp->_a=NULL;
    hp->_capacity=0;
    hp->_size=0;
}

void HeapPush(Heap* hp, HPDataType x)
{
    
}

void CreateNDate()
{
	// 造数据
	int n = 10000;
	srand(time(0));
	const char* file = "data.txt";
	FILE* fin = fopen(file, "w");
	if (fin == NULL)
	{
		perror("fopen error");
		return;
	}

	for (size_t i = 0; i < n; ++i)
	{
		int x = rand() % 1000000;
		fprintf(fin, "%d\n", x);
	}

	fclose(fin);
}

void PrintTopK(int k)
{

}